package com.app.ryjy.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 招聘会类型枚举
 */
@AllArgsConstructor
@Getter
public enum JobFairTypeEnum {
    // 现场招聘会
    ON_SITE_FAIR("现场招聘会", 1, -1),
    // 网络招聘会
    ONLINE_FAIR("网络招聘会", 2, -1);

    private final String desc;
    private final int code;
    private final int bizCode;

    /**
     * 根据 bizCode 获取 code
     *
     * @param bizCode bizCode
     * @return code
     */
    public static int getCodeByBizCode(int bizCode) {
        for (JobFairTypeEnum type : values()) {
            if (type.getBizCode() == bizCode) {
                return type.getCode();
            }
        }
        throw new RuntimeException("bizCode 不存在");
    }

    public static void main(String[] args) {
        System.out.println(JobFairTypeEnum.getCodeByBizCode(1));
    }
}